package dao

import (
	_ "github.com/go-sql-driver/mysql"
	"github.com/jinzhu/gorm"
)

var db *gorm.DB
var err error

func InitDb() (*gorm.DB,error) {
	db, err = gorm.Open("mysql", "root:9527@tcp(81.70.78.200:3306)/jol?charset=utf8&parseTime=True&loc=Local")
	//db.SingularTable(true)
	//db.AutoMigrate(&model.User{})
	if err != nil{
		panic(err)
	}
	return db,err
}

func GetDb() *gorm.DB {
	return db
}
